package vn.com.epi.algorithm.clustering;

public class Pair implements Comparable<Pair> {

	private int key;
	private float value;
	
	public Pair() {
		
	}
	
	public Pair(int key, float value) {
		setKey(key);
		setValue(value);
	}

	public int getKey() {
		return key;
	}

	public void setKey(int key) {
		this.key = key;
	}

	public float getValue() {
		return value;
	}

	public void setValue(float value) {
		this.value = value;
	}

	@Override
	public int compareTo(Pair o) {	
		if (value < o.getValue())
			return -1;
		else if (value > o.getValue())
			return 1;
		else if (key == o.getKey())
			return 0;
		else
			return key > o.getKey() ? 1:-1;
	}
	
	public String toString() {
		return "(" + key + "," + value + ")";
	}
	
}
